package com.ruoyi.library.controller;

import javax.annotation.Resource;

import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.library.api.query.DigitalTwinBusinessQuery;
import com.ruoyi.library.api.vo.DigitalTwinBusinessVO;
import com.ruoyi.library.domain.DtsDigitalTwinBusiness;
import com.ruoyi.library.service.IDtsDigitalTwinBusinessService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.core.web.controller.BaseController;

/**
 * 业务信息
 *
 * @author ZhangYu
 * @date 2024-05-20
 */
@Api(tags = "业务信息")
@RestController
@RequestMapping("/business")
public class DtsDigitalTwinBusinessController extends BaseController {

    @Resource
    private IDtsDigitalTwinBusinessService digitalTwinBusinessService;

    /**
     * 业务信息分页
     *
     * @param digitalTwinBusinessQuery 空间信息查询条件
     * @return 业务信息分页
     */
    @ApiOperation("业务信息分页")
    @GetMapping("/page")
    public R<Page<DigitalTwinBusinessVO>> businessInfoPage(DigitalTwinBusinessQuery digitalTwinBusinessQuery) {
        Page<DigitalTwinBusinessVO> businessInfoPage = digitalTwinBusinessService.businessInfoPage(digitalTwinBusinessQuery);
        return R.ok(businessInfoPage);
    }

    /**
     * 业务详情
     *
     * @param id 唯一主键
     * @return 业务详情
     */
    @ApiOperation("业务详情")
    @GetMapping("/info")
    public R<DigitalTwinBusinessVO> getInfoById(@RequestParam Long id) {
        DtsDigitalTwinBusiness digitalTwinBusiness = digitalTwinBusinessService.getById(id);
        return R.ok(BeanUtil.copyProperties(digitalTwinBusiness, DigitalTwinBusinessVO.class));
    }

}
